#ifndef _ASYNFRAMEIMPL_H_
#define _ASYNFRAMEIMPL_H_

#include "stdafx.h"

class CAsynFrameImpl :	public	IAsynFrame,
						public  IPlugin,
						public  IPluginRun,
						public	CUnknownImp,
						public	CThread,
						public	IoContextBase
{
public:
	CAsynFrameImpl(void);
	virtual ~CAsynFrameImpl(void);

	BEGIN_STDCOM_MAP
		STDCOM_INTERFACE_ENTRY_UNKNOWN_(IAsynFrame)
		STDCOM_INTERFACE_ENTRY(IPlugin)
		STDCOM_INTERFACE_ENTRY(IPluginRun)
		STDCOM_INTERFACE_ENTRY(IAsynFrame)
	END_STDCOM_MAP

	//IPlugin
	std_method(Init)(int Argc, basic_tchar* Argv[], IBase* pRot, IBase* pBase);
	std_method(Uninit)();
	
	//IPluginRun
	std_method(Start)(_pinstance hInstance, UINT uType);
	std_method(Stop)(UINT uExitCode);
	
	//IAsynFrame
	std_method(CreateIo)(IO_Protocol iop, IBase** pBase);
	std_method(PostIo)(IBase* pOperation);
protected:
	//ithread
	std_method(Thread_Init)();
	std_method(Thread_Run)();
	std_method(Thread_UnInit)();
	std_method(SetService)(bool bstart);
private:
	std_method(CreateAsynIoOperation)(IBase **ppOperation);
	std_method(CreateFile)(IBase** pFile);
	std_method(CreateTcpSocket)(IBase** pAsynTcpSocket);
	std_method(CreateUdpSocket)(IBase** pAsynUdpSocket);
	std_method(CreateTcpListenSocket)(IBase** pAsynTcpListenSocket);
	std_method(CreateTimer)(IBase** pTimer);
private:
	RotPtr	m_pRot;
private:
	CSemHandle										m_asynframe_sem;
	SafePtr<io_contextpool_t*, default_safeptr>		m_pContextPool;

};
#endif


